package sivan.test;

import org.junit.Test;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.util.BitSet;
import java.util.Random;

public class JdkDemo {

//   public static void main(String[] args) {
//        double a = 1.0 - 0.9;
//        double b = 0.8 - 0.7;
//        System.out.println(a == b);
//
//        double c = 1.0f - 0.9f;
//        double d = 0.8f - 0.7f;
//        System.out.println(c == d);
//
//        BigDecimal e = new BigDecimal(1.0 - 0.9);
//        BigDecimal f = new BigDecimal(0.8 - 0.7);
//        System.out.println(e.equals(f));
//
//        BigDecimal h = BigDecimal.valueOf(1.0).subtract(BigDecimal.valueOf(0.9));
//        BigDecimal g = BigDecimal.valueOf(0.8).subtract(BigDecimal.valueOf(0.7));
//        System.out.println(h.equals(g));
//
//        System.out.println(Long.BYTES);
//        System.out.println(Double.BYTES);
//        System.out.println(Float.BYTES);
//        System.out.println(Integer.BYTES);
//    }

    @Test
    public void encode() throws UnsupportedEncodingException {
        String data = URLEncoder.encode("\uD840\uDC86", "utf-8");
        System.out.println(data);

        data = URLDecoder.decode(data, "utf-8");
        System.out.println();
    }

    @Test
    public void test() {
        LocalDate begin = LocalDate.of(2019, 8, 1);
        LocalDate end = LocalDate.of(2019, 7, 31);
        Random random = new Random();
        System.out.println(end.compareTo(begin) > 0);
    }

    @Test
    public void dataTest() {
        String data = "u282iLC4KMuBH7+BHeTUdJSGocJwVQv3m2h7FrKGnn0BKamAhJONik9mQ6cacb8vEcHTvgBbJ1Tg86VXO8HnG+zEAPlkhWA+t2qxL9PfWs022I/ctAsi8gxW8GqKTHisaPZo/SqSbf2kV5LRCumr9ChStsOiS+RFl129ncNYxLn2krWD74O17R2h4LoMOMs3hW0qP/ZvA2V0sD1HeqSyJm82/eeB0fUlbNN4rw9lBpw7qt4+NbHaXPB2zKvZOXqZv+skbe0zI4B3MLAJRltxxi+Xsm/+jplXAzwN+3k0uUtmoTb5mT1mT9DqgsxhqdSiReOcqomkuJF5wIihFVox1aVdgM2eDhWROCkMh4A/vKY/BqC2Lw4T1/KwrsffQAF5cRN9d/ZH0Pq21VQuWuBZoyP/yLmbMnrBYxlzSmP5QNI+TJ+o+B2l8OpjjasQ0/4WC0RAsk9EOqfSoPVD9H+3yxEgxM+YUCgotUrSC/ytyfAamiadN01f3Z9zIoHKFdKj8kMOJYbGQ1lp0xWCbGP9jdmbK08v1YoDn/4cK11oASimKOUekJMqNTSYM6aHE24w9h/sezw+aZP8exjzTZf+AvLD0gpMIcUVBQUOdggdfdmiGd8Hiznidb6/OLAqrBAFijpMDqXMrqkY03j3tXBySmOkmtHmdnjYIYLMG7Vcoy+btOc5rDODdB99efeEF5l1oncDg/5EjJRYhFoSVZl0sJSDM1GPzufcUzkeSj0tlx4TVfs2tDUWXYqufgiUEd4aJ6a6XbIqUIactJIV0op2vDTqrSNoyqGa5fygubTbVtcipUnGyFzOvSWf/cAIgonQp2VeNOyA4VzCv5woJNSz3C7xB3D8lDJ9VqdT18F1G3v3RTqKU+rCtU57K773ywu66QfZbswk1vbvmUdb+M2RrCsRcTYSlBlKsXDAkVkIhqUQ3vbrByql3AzEAZ3oz4r7bjE5stuZHfJU5k7+onzmFUtEdRkbpyPAvpCF/bXX42uXKwVh9yq0oh+tuG7z5+yIK9CHEv/4w7WgHQxVuDImQ56+B856PEPowE5QnR7I+oA=";
    }

    static final int SIZE = 2 * 1024 * 1024;

    public static void main(String[] a) throws UnsupportedEncodingException {
//        String str = "%E6%AC%A2%E8%BF%8E%E6%9D%A5%E5%88%B0%E7%9C%81%E7%82%B9%E8%8A%B1%E4%BC%98%E9%80%89%21%0A%0A%E2%98%85%E7%9C%81%E7%82%B9%E8%8A%B1%E9%94%A6%E9%B2%A4%E5%8D%A1%E4%BC%9A%E5%91%98%E4%B8%93%E4%BA%AB%E7%8B%AC%E5%AE%B6%E7%89%B9%E6%9D%83%EF%BC%8C%E5%85%A8%E5%9B%BD%E5%8A%A0%E6%B2%B9%E4%BD%8E%E8%87%B38%E6%8A%98%E8%B5%B7%EF%BC%8C%E7%9C%8B%E8%A7%86%E9%A2%91%E5%90%AC%E6%AD%8C%E4%BD%8E%E8%87%B35%E6%8A%98%E8%B5%B7%EF%BC%8C%E5%A4%96%E5%8D%96%E7%BA%A2%E5%8C%85%E6%AF%8F%E6%97%A5%E6%9C%80%E9%AB%98%E5%8F%AF%E9%A2%8666%E5%85%83%EF%BC%8C%E7%89%B9%E4%BB%B7%E5%95%86%E5%93%81%E5%A4%A9%E5%A4%A91%E5%85%83%E6%8A%A2%E8%B4%AD%E3%80%82%0A%0A%E2%98%85%E7%83%AD%E9%97%A8%E6%8A%98%E6%89%A3%E5%95%86%E5%93%81%E4%B9%B01%E9%80%811+%EF%BC%9A%0A%3E%3E%3Ca+href%3D%27https%3A%2F%2Fshop44894964.m.youzan.com%2Fwscgoods%2Fdetail%2F3eu9o4k3er3fg%3Fdc_ps%3D2694268412850473993.200001%27%3E%E4%B8%89%E5%B1%82%E9%98%B2%E6%8A%A4%E5%8F%A3%E7%BD%A9%C2%A50.29%2F%E4%B8%AA%3C%2Fa%3E%0A%3E%3E%3Ca+href%3D%27https%3A%2F%2Fshop44894964.m.youzan.com%2Fwscgoods%2Fdetail%2F2oj0ruq3so198%3Fdc_ps%3D2703496444240887813.200001%27%3E%E8%B6%85%E4%BF%9D%E6%9A%96%E6%B0%B4%E8%B2%82%E7%BB%92%E5%8D%AB%E8%A3%A4%C2%A526.3%3C%2Fa%3E%0A%3E%3E%3Ca+href%3D%27https%3A%2F%2Fshop44894964.m.youzan.com%2Fwscgoods%2Fdetail%2F3exzwyf394h4c%3Fdc_ps%3D2703496763519789064.200001%27%3E%E6%96%B0%E7%96%86%E5%8E%9F%E7%94%9F%E6%80%81%E9%AA%86%E9%A9%BC%E5%A5%B6%C2%A539.9%3C%2Fa%3E%0A%3E%3E%3Ca+href%3D%27https%3A%2F%2Fshop44894964.m.youzan.com%2Fwscgoods%2Fdetail%2F3eruw0bci1uvg%3Fdc_ps%3D2703497229758621696.200001%27%3E%E4%B8%AD%E8%8D%AF%E4%BD%95%E9%A6%96%E4%B9%8C%E9%BB%91%E5%8F%91%E5%96%B7%E9%9B%BE%C2%A524.9%3C%2Fa%3E%0A%3E%3E%3Ca+href%3D%27https%3A%2F%2Fshop44894964.youzan.com%2Fv2%2Ffeature%2FlK4yM3wwSo%3Fdc_ps%3D2671775834074906630.200001%27%3E%E5%B9%B4%E8%B4%A7%E5%85%A8%E5%9C%BA%E9%99%90%E6%97%B65%E6%8A%98%E8%B5%B7%3C%2Fa%3E%0A%0A%E2%98%85%E9%94%A6%E9%B2%A4%E4%B8%93%E5%B1%9E%E7%A6%8F%E5%88%A9%3E%3E%3Ca+data-miniprogram-appid%3D%27wx73e6f8591b4d6327%27+data-miniprogram-path%3D%27%3Fwxgamecid%3DCCBgAAoXkpQY8Zl7nPEJ1b%27+href%3D%27https%3A%2F%2Fmas1.shengdianhuadg.com%2Fexternal_service%2Fcommon%3Fappid%3D3%26funid%3D1%26channel%3D861008%27%3E%E5%85%8D%E8%B4%B9%E9%A2%86%E7%BA%A2%E5%8C%85%E5%B8%81%3C%2Fa%3E%0A%0A%E2%98%85%E6%90%9C%E7%B4%A2%E5%85%B3%E6%B3%A8%22%E7%9C%81%E9%92%B1%E6%98%9F%E7%90%83%22%E9%A2%86%E4%B8%93%E5%B1%9E%E4%BC%98%E6%83%A0%E5%88%B8%EF%BC%8C%E5%8F%91%E7%8E%B0%E6%9B%B4%E5%A4%9A%E4%BC%98%E6%83%A0%E4%BF%A1%E6%81%AF%EF%BC%81%0A%0A%E2%98%85%E5%85%A8%E5%9B%BD%E5%90%83%E5%96%9D%E7%8E%A9%E4%B9%90%E9%94%A6%E9%B2%A4%E7%89%B9%E6%9D%83%EF%BC%8C%E8%BF%98%E6%B2%A1%E5%8A%9E%E5%8D%A1%E7%82%B9%E8%BF%99%E9%87%8C%E2%86%93%0A%3E%3E%3Ca+href%3D%27https%3A%2F%2Fmas2.shengdianhuadg.com%2Fexternal_service%2Fcommon%3Fappid%3D3%26funid%3D1%26channel%3D861008%27%3E%E7%82%B9%E5%87%BB%E5%85%8D%E8%B4%B9%E5%8A%9E%E7%90%86%E7%9C%81%E7%82%B9%E8%8A%B1%E9%94%A6%E9%B2%A4%E5%8D%A1%3C%2Fa%3E%0A%0A%E5%A6%82%E5%AF%B9%E9%94%A6%E9%B2%A4%E5%8D%A1%E4%BD%BF%E7%94%A8%E3%80%81%E5%95%86%E5%9F%8E%E8%AE%A2%E5%8D%95%E4%BF%A1%E6%81%AF%E7%AD%89%E6%9C%89%E6%89%80%E7%96%91%E9%97%AE%EF%BC%8C%E5%8F%AF%E4%BB%A5%E8%81%94%E7%B3%BB%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%9C%8D%E4%B8%BA%E4%BD%A0%E8%A7%A3%E5%86%B3%E5%93%A6%7E%E5%9B%9E%E5%A4%8D%E3%80%90%E4%BA%BA%E5%B7%A5%E5%AE%A2%E6%9C%8D%E3%80%91%E5%8D%B3%E5%8F%AF%E5%8F%AC%E5%94%A4%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%9C%8D%EF%BC%88%E5%9C%A8%E7%BA%BF%E6%97%B6%E9%97%B4%EF%BC%9A%E6%AF%8F%E5%A4%A99%3A00-22%3A00%EF%BC%89";
//        System.out.println(URLDecoder.decode(str, "UTF-8"));

        String str1 = "欢迎来到省点花优选！\n" +
                "\n" +
                "★<a href='https://shop44894964.youzan.com/v2/feature/lK4yM3wwSo?dc_ps=2727398532641377286.200001'>锦鲤会员专属领100元津贴</a>\n" +
                "\n" +
                "★关注公众号免费送\n" +
                "关注<a href='https://riyugo.com/i/2021/03/10/psdyyr.jpg'>【锦鲤姐妹淘】</a>口红免费送\n" +
                "关注<a href='https://riyugo.com/i/2021/03/10/psivi7.jpg'>【锦鲤爱车帮】</a>夜视镜免费送\n" +
                "关注【省钱星球】每周五晚锦鲤卡权益手把手教学\n" +
                "\n" +
                "★省点花锦鲤卡会员专享独家特权，外卖红包天天最高可领66元，30元加油券免费领，看视频听歌1元秒杀，还没办卡点这里>><a href='https://mas1.shengdianhuadg.com/external_service/common?appid=3&funid=1&channel=861008'>点击免费办卡</a>\n" +
                "\n" +
                "★<a data-miniprogram-appid='wx73e6f8591b4d6327'\n" +
                "data-miniprogram-path='?wxgamecid=CCBgAAoXkpQY8Zl7nPEJ1b' href='https://mas1.shengdianhuadg.com/external_service/common?appid=3&funid=1&channel=861008'>每日领10元分红</a>\n" +
                "\n" +
                "★添加<a href='https://riyugo.com/i/2021/03/10/pb5ces.png'>【花妞】</a>为好友，1元搞点生活日常所需品\n" +
                "\n" +
                "如对锦鲤卡使用、商城订单信息等有所疑问，可以联系在线客服为你解决哦~回复【人工客服】即可召唤在线客服（在线时间：每天9:00-22:00";
        Random random = new Random();
        int index = random.nextInt(100);
        System.out.println(URLEncoder.encode(str1,"UTF-8"));
    }

    @Test
    public void testBitset() {
        BitSet bits1 = new BitSet();
        BitSet bits2 = new BitSet();
        for(int i=0; i<16; i++) {
            if((i%2) == 0) bits1.set(i);
            if((i%5) != 0) bits2.set(i);
        }
        System.out.println(bits1);
    }
}
